﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using FarseerGames.FarseerPhysics;
using FarseerGames.FarseerPhysics.Collisions;
using FarseerGames.FarseerPhysics.Dynamics;
using FarseerGames.FarseerPhysics.Factories;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using Microsoft.Xna.Framework.Graphics;

namespace FolderData
{
    public class Story
    {
        public String BgAssetName;
        public List<String> StringList;


        #region Processor
        public class StoryReader : ContentTypeReader<Story>
        {
            protected override Story Read(ContentReader input, Story existingInstance)
            {
                Story story = new Story();
                story.BgAssetName = input.ReadString();
                story.StringList = new List<string>();
                int count = input.ReadInt32();
                for (int i = 0; i < count; i++)
                    story.StringList.Add(input.ReadString());

                return story;
            }
        }

        [ContentTypeWriter]
        public class StoryWriter : ContentTypeWriter<Story>
        {
            protected override void Write(ContentWriter output, Story value)
            {
                output.Write(value.BgAssetName);
                output.Write(value.StringList.Count);
                for (int i = 0; i < value.StringList.Count; i++)
                    output.Write(value.StringList[i]);
            }
            public override string GetRuntimeReader(TargetPlatform targetPlatform)
            {
                return typeof(Story.StoryReader).AssemblyQualifiedName;
            }
            public override string GetRuntimeType(TargetPlatform targetPlatform)
            {
                return typeof(Story).AssemblyQualifiedName;
            }
        }
        #endregion
    }
}
